﻿using System;
using System.Collections.Generic;
using System.Text;
using ReactiveUI;

namespace AvaloniaApplication1.ViewModels
{
    public class SignCertificateWindowViewModel:ViewModelBase
    {
        private string m_Title = "签名证书";

        /// <summary>
        /// 标题
        /// </summary>
        public string Title
        {
            get { return m_Title; }
            set
            {
                m_Title = value;
                this.RaiseAndSetIfChanged(ref m_Title, value);
            }
        }

        public string NameFirstCode
        {
            get { return GetFirstValue();}
        }

        /// <summary>
        ///姓名
        /// </summary>
        private string m_Name="Annie 张媛媛";

        /// <summary>
        ///姓名
        /// </summary>
        public string Name
        {
            get { return m_Name; }
            set
            {
                m_Name = value;
                this.RaiseAndSetIfChanged(ref m_Name, value);
                this.RaisePropertyChanged(nameof(NameFirstCode));
            }
        }

        /// <summary>
        ///类型
        /// </summary>
        private string m_Type = "个人";

        /// <summary>
        ///类型
        /// </summary>
        public string Type
        {
            get { return m_Type; }
            set
            {
                this.RaiseAndSetIfChanged(ref m_Type, value);
            }
        }


        /// <summary>
        ///国家
        /// </summary>
        private string m_Country="CN";

        /// <summary>
        ///国家
        /// </summary>
        public string Country
        {
            get { return m_Country; }
            set
            {
                m_Country = value;
                this.RaiseAndSetIfChanged(ref m_Country, value);
            }
        }

        /// <summary>
        ///省份
        /// </summary>
        private string m_Province="江苏省";

        /// <summary>
        ///省份
        /// </summary>
        public string Province
        {
            get { return m_Province; }
            set
            {
                m_Province = value;
                this.RaiseAndSetIfChanged(ref m_Province, value);
            }
        }

        /// <summary>
        ///城市
        /// </summary>
        private string m_City="无锡市";

        /// <summary>
        ///城市
        /// </summary>
        public string City
        {
            get { return m_City; }
            set
            {
                m_City = value;
                this.RaiseAndSetIfChanged(ref m_City, value);
            }
        }

        private string GetFirstValue()
        {
            if (string.IsNullOrEmpty(m_Name))
            {
                return "?";
            }
            else
            {
                return m_Name[0].ToString();
            }


        }




    }
}
